package com.hanson.controller;

import com.hanson.common.bean.ResultMessage;
import com.hanson.entity.GoodsCommentBean;
import com.hanson.service.GoodsCommentService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequestMapping("/web/goodsComment")
public class WebGoodsCommentController {
    @Autowired
    private GoodsCommentService goodsCommentService;

    @RequestMapping(value = "/add", method = RequestMethod.POST)
    public ResultMessage add(@RequestBody GoodsCommentBean goodsCommentBean, @CookieValue("openId") String openId) throws Exception {
        goodsCommentService.addComment(goodsCommentBean, openId);
        ResultMessage resultMessage = new ResultMessage();
        resultMessage.setMsg("添加评论成功！");
        return resultMessage;
    }
}
